﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataModel;

namespace SchoolDataLayer
{
    public class DLFile
    {
        public int SaveFile(FileData _file)
        {
            using (SqlConnection conn = DBConn.GetConnectionString())
            {
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "ProcSaveFile";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@FileName",_file.FileName);
                    cmd.Parameters.AddWithValue("@FilePath",_file.FilePath);
                    cmd.Parameters.AddWithValue("@UserId",_file.UserId);
                    cmd.Parameters.AddWithValue("@uploadedon",DateTime.Now);
                    return cmd.ExecuteNonQuery();
                }
            }
        
        }

    }
}
